%h3 Information retrieved from GitHub
%dl
  %dt Username:
  %dd= template_form.user.github_username
  %dt Email Address:
  %dd= template_form.user.email

%p
  = link_to "Replace GitHub Token", '#', id: 'token-replace'

#update-token-modal
  = render 'github_token_replace', user: @user

= form_for template_form, url: templates_path do |f|
  = f.hidden_field :app_id
  %h3 Select a repository for your application template
  = f.select :repo, options_for_select(template_form.user.repositories), {}, class: 'fancy'

  or,
  = link_to 'create a new Github repo', 'https://github.com/new', target: '_blank'

  %h3 Add some information about your template to help others find it in search results

  %dl
    %dt= f.label :name, 'Template Name', class: 'required'
    %dd= f.text_field :name, placeholder: 'Give your template a name'
    %dt= f.label :author, 'Template Author'
    %dd= f.text_field :author
    %dt= f.label :description, 'Template Description'
    %dd= f.text_area :description, placeholder: 'Give your template a description'
    %dt= f.label :keywords, class: 'optional'
    %dd= f.text_field :keywords, placeholder: 'Add some keywords, seperated by commas'
    %dt.optional Template Icon
    %dd.template-icons
      - f.object.types.each do |type|
        = label_tag do
          = f.radio_button :type, type.name
          = image_tag icon_source_for(type.name)
          %span= type.name

  %h3 Template Documentation
  %label.documentation
    %div
      %strong
        Add some instructions to help people use your template. Check out some
        = succeed '.' do
          %a{href: 'https://github.com/CenturyLinkLabs/panamax-ui/wiki/How-To:-Create-Template-Documentation', target: '_blank'} examples

    Confused about the syntax?
    = link_to 'See the markdown guide here', 'http://daringfireball.net/projects/markdown/syntax', target: '_blank'
    = f.text_area :documentation, class: 'template_documentation'

  - tracking_hash = { tracking_method: 'click', tracking_category: 'Create Template', tracking_action: 'Initiate Save Template', tracking_label: template_form.app.try(:name) }
  = button_tag 'Publish Your Template', class: 'button-positive', data: tracking_hash
  = button_tag 'Preview Template File', type: 'button', class: 'button-secondary preview', data: { previewPath: template_app_path(template_form.app_id) }
